package com.tanfuqi.sicent.server.controller

import com.tanfuqi.sicent.protocol.message.Fee
import com.tanfuqi.sicent.protocol.message.Message
import com.tanfuqi.sicent.server.filter.sent
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.PatchMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Mono

@RestController
class ModeController:BaseController() {
    @ApiOperation(value = "转消费模式")
    @PatchMapping("/shop/{shopId}/member/{cardId}/mode")
    fun mode(@PathVariable shopId: String, @PathVariable cardId: String,
             @RequestBody fee: Fee): Mono<Any> =
            session(shopId).sent(Message(0x8048, body = fee)).map { it.body }
}